<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<link rel="stylesheet" type="text/css" href="/static/component/laytp/module/cityPicker/city-picker.css">

<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title"><div class="page-title-con"><span>新建人员</span><div class="move_title"></div><?php include "../public/sub.php";?></div></div>
    <div class="main-container">

        <div class="block-generic">
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="edittits"><span>基本信息</span></div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>人员姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" id="name" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">员工编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="number" id="number" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>所属部门</label>
                        <div class="layui-input-block relative">
                            <div class="tanxian">
                                <div class="tanxianclick" onclick="openPage('../public/choose_userpart.php?dom=deptid&type=dept','770px','490px');"></div>
                                <div class="tanxiannei" id="deptid"></div>
                            </div>
                            <div class="tancheckdiv"><div class="tancheck" onclick="openPage('../public/choose_userpart.php?dom=deptid&type=dept','770px','490px');"><i class="layui-icon layui-icon-search"></i></div></div>
                            <div id="deptid_tanerror" class="tanerrormsg"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>身份证号</label>
                        <div class="layui-input-block">
                            <input type="text" name="idcard" id="idcard" placeholder="请输入" maxlength="18" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">身份证有效期</label>
                        <div class="layui-input-block">
                            <input type="text" name="idcarddt" id="idcarddt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">联系方式</label>
                        <div class="layui-input-block">
                            <input type="text" name="tel" id="tel" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">民族</label>
                        <div class="layui-input-block">
                            <div id="nation"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">籍贯</label>
                        <div class="layui-input-block">
                            <input type="text" name="jiguan" id="jiguan" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">出生地</label>
                        <div class="layui-input-block" style="z-index: 1;">
                            <input type="text" name="areas" id="areas" placeholder="请选择" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">参加工作时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="candt" id="candt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">政治面貌</label>
                        <div class="layui-input-block">
                            <div id="mian"></div>
                        </div>
                    </div>
                </div>
            </div>




            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="edittits"><span>学历信息</span></div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">全日制学历</label>
                        <div class="layui-input-block">
                            <select id="yuan_xue" name="yuan_xue" lay-filter="yuan_xue"></select>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">毕业院校</label>
                        <div class="layui-input-block">
                            <input type="text" name="yuan_yuan" id="yuan_yuan" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">专业</label>
                        <div class="layui-input-block">
                            <input type="text" name="yuan_zhuan" id="yuan_zhuan" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">学位</label>
                        <div class="layui-input-block">
                            <input type="text" name="yuan_xuewei" id="yuan_xuewei" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">毕业时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="yuan_dt" id="yuan_dt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">是否双一流</label>
                        <div class="layui-input-block">
                            <select id="yuan_liu" name="yuan_liu" lay-filter="yuan_liu">
                                <option value="">请选择</option>
                                <option value="是">是</option>
                                <option value="否">否</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">在职学历</label>
                        <div class="layui-input-block">
                            <select id="zai_xue" name="zai_xue" lay-filter="zai_xue"></select>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">毕业院校</label>
                        <div class="layui-input-block">
                            <input type="text" name="zai_yuan" id="zai_yuan" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">专业</label>
                        <div class="layui-input-block">
                            <input type="text" name="zai_zhuan" id="zai_zhuan" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">毕业时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="zai_dt" id="zai_dt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">最高学历</label>
                        <div class="layui-input-block">
                            <select id="gao_xue" name="gao_xue" lay-filter="gao_xue"></select>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">毕业院校</label>
                        <div class="layui-input-block">
                            <input type="text" name="gao_yuan" id="gao_yuan" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">专业</label>
                        <div class="layui-input-block">
                            <input type="text" name="gao_zhuan" id="gao_zhuan" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">毕业时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="gao_dt" id="gao_dt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">是否全日制</label>
                        <div class="layui-input-block">
                            <select id="gao_quan" name="gao_quan" lay-filter="gao_quan">
                                <option value="">请选择</option>
                                <option value="是">是</option>
                                <option value="否">否</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">是否双一流</label>
                        <div class="layui-input-block">
                            <select id="gao_liu" name="gao_liu" lay-filter="gao_liu">
                                <option value="">请选择</option>
                                <option value="是">是</option>
                                <option value="否">否</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>



            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="edittits"><span>任职信息</span></div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">本单位入职时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="intodt" id="intodt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">现工作岗位及职务</label>
                        <div class="layui-input-block">
                            <input type="text" name="xianzhi" id="xianzhi" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">任现职时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="ren_xiandt" id="ren_xiandt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">任现职级时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="ren_zhidt" id="ren_zhidt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">干部级别</label>
                        <div class="layui-input-block">
                            <select id="ganji" name="ganji" lay-filter="ganji"></select>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">管理权限</label>
                        <div class="layui-input-block">
                            <select id="guanquan" name="guanquan" lay-filter="guanquan"></select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label">岗位类型</label>
                        <div class="layui-input-block">
                            <select id="ganglei" name="ganglei" lay-filter="ganglei"></select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">是否项目经理</label>
                        <div class="layui-input-block">
                            <select id="isxiang" name="isxiang" lay-filter="isxiang">
                                <option value="">请选择</option>
                                <option value="是">是</option>
                                <option value="否">否</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">任职时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="xiangdt" id="xiangdt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label"><text>*</text>人员状态</label>
                        <div class="layui-input-block radio-block">
                            <input type="radio" name="state" lay-filter="state" checked value="在职" title="在职">
                            <input type="radio" name="state" lay-filter="state" value="离职" title="离职">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-hide lizhi">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">离职日期</label>
                        <div class="layui-input-block">
                            <input type="text" name="outdt" id="outdt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">离职说明</label>
                        <div class="layui-input-block">
                            <input type="text" name="outexp" id="outexp" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">合同签订单位</label>
                        <div class="layui-input-block">
                            <div class="tanxian">
                                <div class="tanxianclick" onclick="openPage('../public/choose_userpart.php?dom=qianid&type=dept&dept=chan&single=1','770px','490px');"></div>
                                <div class="tanxiannei" id="qianid"></div>
                            </div>
                            <div class="tancheckdiv"><div class="tancheck" onclick="openPage('../public/choose_userpart.php?dom=qianid&type=dept&dept=chan&single=1','770px','490px');"><i class="layui-icon layui-icon-search"></i></div></div>
                            <div id="qianid_tanerror" class="tanerrormsg"></div>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">现劳动合同类型</label>
                        <div class="layui-input-block">
                            <select id="laolei" name="laolei" lay-filter="laolei"></select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">现劳动合同起止</label>
                        <div class="layui-input-block">
                            <input type="text" name="xianqizhi" id="xianqizhi" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_sea_range_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">缴纳社保地点</label>
                        <div class="layui-input-block">
                            <select id="socaddr" name="socaddr" lay-filter="socaddr"></select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item height_auto">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label label_textarea">备注</label>
                        <div class="layui-input-block">
                            <textarea id="explain" name="explain" placeholder="请输入" class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>
            <?php include '../public/upinfo.php'?>
        </div>


    </div>
</form>
<script>

    $("#commentForm").validate({
        rules: {
            name: {required: true},
            idcard: {required: true},
        },
        messages:{
            name: {required: "请输入"},
            idcard: {required: "请输入"},
        }
    });

    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();

        layui.use(['laydate','layer'],function(){
            var laydate = layui.laydate;
            lay('.bdate_sea_range_ymd').each(function(){
                laydate.render({
                    elem: this
                    ,trigger: 'click'
                    ,type: 'date'
                    ,range: true
                    ,done: function(value, date, endDate){
                        var thisObj = $(this)[0].elem;
                        setTimeout(function () {
                            dataLayerAfterSea(thisObj);
                        },200)
                    }
                });
            });
        });



        facade.ajax({type: 'get', url: ask_cert_person_add}).done(function(res){
            if (res.code === 2000) {
                xmselect_dan('nation', res.data.nation, '');
                xmselect_dan('mian', res.data.mian, '');

                var yuan_xue = res.data.xueli;
                var yuan_xue_str = '<option value=""></option>';
                for (var i in yuan_xue){
                    yuan_xue_str += '<option value="'+yuan_xue[i]+'">'+yuan_xue[i]+'</option>';
                }
                $('#yuan_xue').html(yuan_xue_str);


                var zai_xue = res.data.xueli;
                var zai_xue_str = '<option value=""></option>';
                for (var i in zai_xue){
                    zai_xue_str += '<option value="'+zai_xue[i]+'">'+zai_xue[i]+'</option>';
                }
                $('#zai_xue').html(zai_xue_str);

                var gao_xue = res.data.xueli;
                var gao_xue_str = '<option value=""></option>';
                for (var i in gao_xue){
                    gao_xue_str += '<option value="'+gao_xue[i]+'">'+gao_xue[i]+'</option>';
                }
                $('#gao_xue').html(gao_xue_str);


                var ganji = res.data.ganji;
                var ganji_str = '<option value=""></option>';
                for (var i in ganji){
                    ganji_str += '<option value="'+ganji[i]+'">'+ganji[i]+'</option>';
                }
                $('#ganji').html(ganji_str);

                var guanquan = res.data.guanquan;
                var guanquan_str = '<option value=""></option>';
                for (var i in guanquan){
                    guanquan_str += '<option value="'+guanquan[i]+'">'+guanquan[i]+'</option>';
                }
                $('#guanquan').html(guanquan_str);

                var ganglei = res.data.ganglei;
                var ganglei_str = '<option value=""></option>';
                for (var i in ganglei){
                    ganglei_str += '<option value="'+ganglei[i]+'">'+ganglei[i]+'</option>';
                }
                $('#ganglei').html(ganglei_str);

                var laolei = res.data.laolei;
                var laolei_str = '<option value=""></option>';
                for (var i in laolei){
                    laolei_str += '<option value="'+laolei[i]+'">'+laolei[i]+'</option>';
                }
                $('#laolei').html(laolei_str);

                var socaddr = res.data.socaddr;
                var socaddr_str = '<option value=""></option>';
                for (var i in socaddr){
                    socaddr_str += '<option value="'+socaddr[i]+'">'+socaddr[i]+'</option>';
                }
                $('#socaddr').html(socaddr_str);



                public_upload_file_load('upload_files');
                render_from();
            }
        });

        form.on('radio(state)', function(data){
            if(data.value === '离职'){
                $('.lizhi').removeClass('layui-hide');
            }else{
                $('.lizhi').addClass('layui-hide');
            }
        });

        form.on('submit(add)', function(data){
            var validRes = $("#commentForm").valid();

            data.field.deptid = tan_tags_getvalue("#deptid", 'dept');
            data.field.qianid = tan_tags_getvalue("#qianid", 'dept');
            if(!data.field.deptid){
                $("#deptid").parents('.tanxian').addClass('tanerror');
                $('#deptid_tanerror').text('请选择');
                validRes = false;
            }else{
                $("#deptid").parents('.tanxian').removeClass('tanerror');
                $('#deptid_tanerror').text('');
            }
            if(!validRes){return false;}

            data.field.files = public_upload_file_value('upload_files');
            facade.ajax({url: ask_cert_person_add, data:data.field}).done(function(res){
                if (res.code === 2000) {
                    dataPostTimeOut();
                }
            });
            return false;
        });

    });

</script>
</body>
</html>
